package com.sh.data.engine.repository.dao.base;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;

import java.io.Serializable;
import java.util.Date;

/**
 * @author: mengzheng.mhc
 * @date: 2024/5/29 15:42
 */
@Data
@EqualsAndHashCode(callSuper = false)
public class EngineBaseModel<T extends EngineBaseModel<?>> extends Model<T> {

    @TableId(value = "id", type = IdType.AUTO)
    protected Long id;

    @TableField(value = "create_time", fill = FieldFill.INSERT)
    protected Date createTime;

    @TableField(value = "creator_id", fill = FieldFill.INSERT)
    protected String creatorId;

    @TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE)
    protected Date updateTime;

    @TableField(value = "updater_id", fill = FieldFill.INSERT_UPDATE)
    protected String updaterId;

    @Override
    public Serializable pkVal() {
        return this.id;
    }
}
